<?php
include_once "conn.php";
$name = $_POST['name'];
$sex = $_POST['sex'];
$barcode = $_POST['barcode'];
$readertype = $_POST['readertype'];
$work = $_POST['work'];
$zhenjian = $_POST['zhenjian'];
$number = $_POST['number'];
$chusheng = $_POST['chusheng'];
$phone = $_POST['phone'];
$mail = $_POST['mail'];
$main = new main();
$check = $main->checkusercode($barcode);
if ($check){
    $a['error']= 2;//重复
}else{
    $result = $main-> adduserinfo($barcode,$name,$sex,$work,$chusheng,$zhenjian,$number,$phone,$mail,time(),$readertype);
    if ($result==1){
        $a['error']= 1;//成功
    }
    else{
        $a['error']=0;
    }
}
echo json_encode($a);